package ch.zbw.timeline.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import lombok.Data;

/**
 * Domain class for an allocation
 */
@Entity
@SequenceGenerator(name = "id_allocation", initialValue = 1, allocationSize = 1)
@Table(name = "allocation")
@Data
public class Allocation implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_allocation", nullable = false)
	private int id;

	@Column(name = "fk_process", nullable = false)
	private int processFk;

	@Column(name = "fk_task", nullable = false)
	private int taskFk;

	@Column(name = "active", nullable = false)
	private int active;

	@Transient
	private Process process;

	@Transient
	private Task task;

	public Allocation() {
	}

	public Allocation(int processFk, int taskFk, int active) {
		this.processFk = processFk;
		this.taskFk = taskFk;
		this.active = active;
	}
}